<template>
  <div class="field-select">
    <template>
      <el-radio-group
        v-model="localValue"
        :style="
          !embeddedTable &&tableField.fieldVariableValue.codeArrangement === 2 &&
            'display:grid;grid-template-columns:repeat(' +
              (tableField.fieldVariableValue.number
                ? tableField.fieldVariableValue.number
                : 1) +
              ', 1fr);justify-items:start;gap:.5rem 0;'
        "
      >
        <el-radio
          v-for="(item, index) in tableField.databaseCodeValueDTO"
          :label="item.codeValue"
          @click.native.prevent="
            disabled ||
              readOnly ||
              (item.codeValue === localValue
                ? (localValue = '')
                : (localValue = item.codeValue))
          "
          :key="index"
          :disabled="disabled || readOnly"
          >{{ item.codeDescribe }}</el-radio
        >
      </el-radio-group>
    </template>
  </div>
</template>

<script>
import Mixins from "./mixins";
export default {
  mixins: [Mixins]
};
</script>

<style lang="scss" scoped>
.field-select {
  /deep/ .el-checkbox__label,
  /deep/ .el-radio__label {
    font-size: 0.75rem;
    white-space: pre-line;
  }
}
</style>